﻿using System;
using System.Net.Sockets;

namespace PhoneNetTools.Ntp
{
    /// <summary>
    /// A custom exception type for NTP exceptions.
    /// </summary>
    public class NtpException : Exception
    {
        /// <summary>
        /// Gets or sets the socket error.
        /// </summary>
        public SocketError SocketError
        {
            get;
            set;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NtpException"/> class.
        /// </summary>
        public NtpException()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NtpException"/> class.
        /// </summary>
        /// <param name="message">The message that describes the error.</param>
        public NtpException(string message) : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NtpException"/> class.
        /// </summary>
        /// <param name="message">The error message that explains the reason for the exception.</param>
        /// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
        public NtpException(string message, Exception innerException) : base(message, innerException)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NtpException"/> class.
        /// </summary>
        /// <param name="message">The message that describes the error.</param>
        /// <param name="socketError">The socket error that caused the exception.</param>
        public NtpException(string message, SocketError socketError) : base(message)
        {
            SocketError = socketError;
        }
    }
}